package tables

import (
	"github.com/GoAdminGroup/go-admin/context"
	"github.com/GoAdminGroup/go-admin/modules/db"
	"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
	"github.com/GoAdminGroup/go-admin/template/types/form"
)

// GetWechatPlugin return the model of table system_templates.
func GetWechatPlugin(ctx *context.Context) (stTable table.Table) {

	stTable = table.NewDefaultTable(table.DefaultConfigWithDriver("postgresql"))

	info := stTable.GetInfo()
	info.AddField("ID", "id", db.Int).FieldSortable()
	info.AddField("名称", "name", db.Varchar)
	info.AddField("插件版本号", "version", db.Varchar)
	info.AddField("插件提供方", "provider", db.Varchar)
	info.SetTable("wechat_plugin").SetTitle("微信小程序插件").SetDescription("微信小程序插件")

	formList := stTable.GetForm()
	formList.AddField("ID", "id", db.Int, form.Default)
	formList.AddField("名称", "name", db.Varchar, form.Text)
	formList.AddField("插件版本号", "version", db.Varchar, form.Text)
	formList.AddField("插件提供方", "provider", db.Varchar, form.Text)

	formList.SetTable("wechat_plugin").SetTitle("微信小程序插件").SetDescription("微信小程序插件")

	return
}
